﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'P_UpdatePersonLocation')
	BEGIN
		DROP  Procedure  esf_sso.P_UpdatePersonLocation
	END

GO

CREATE Procedure esf_sso.P_UpdatePersonLocation
	@pPersonLocationID		BIGINT
	,@pPersonID				BIGINT
	,@pCityID				BIGINT = NULL
	,@pCountryID			BIGINT = NULL
	,@pName					VARCHAR (100)
	,@pCityName				VARCHAR (60)
	,@pPhoneNumber			VARCHAR (30)
	,@pCellPhoneNumber		VARCHAR (30)
	,@pAddress				VARCHAR (30)
	,@pIsMain				BIT
	,@pIsEnabled				BIT
	,@pUserLastUpdateAlias	VARCHAR (20)
	,@pLastUpdateDateTime	DATETIME
AS

	UPDATE [esf_sso].[PersonLocation]
	SET
		[PersonID] = @pPersonID
		,[Name] = @pName
		,[CityID] = @pCityID
		,[CountryID] = @pCountryID
		,CityName = @pCityName
		,[PhoneNumber] = @pPhoneNumber
		,[CellPhoneNumber] = @pCellPhoneNumber
		,[Address] = @pAddress
		,[IsMain] = @pIsMain
		,[LastUpdateDateTime] = @pLastUpdateDateTime
		,[UserLastUpdateAlias] = @pUserLastUpdateAlias
		,[IsEnabled] = @pIsEnabled
	WHERE
		ID = @pPersonLocationID 
           
GO 